var BaseNode = require('./../../FrameWork/Component/BaseNode');
var AnimScoreCtr = require('./../Anim/AnimScoreCtr');
cc.Class({
    extends: BaseNode,

    properties: {
        spriteHead: {
            default: null,
            type: cc.Sprite,
            displayName: '玩家头像'
        },

        lbMoney: {
            default: null,
            type: cc.Label,
            displayName: '玩家钱'
        },
        animScoreCtr: {
            default: null,
            type: AnimScoreCtr,
            displayName: '金币滚动动画组件'
        }
    },
    clean() {
        this.lbMoney.string = '0';
    },
    refreshMoney(_newMoney) {
        this.currMoney = _newMoney;
        this.lbMoney.string = _newMoney.toString();
    },
    addMoney(_addMoney) {
        this.animScoreCtr.play(this.currMoney, (this.currMoney + _addMoney));
        this.currMoney += _addMoney;
    }
});